<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="">
	<meta http-equiv="description" content="This is my page">
	
  </head>
  
  <body>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'新增问卷实例'}]"/>
    			<jsp:param name="width" value="40%"/>
    		</jsp:include>
    		
    		<s:hidden name="paperFix.paper.id" id="paperId"></s:hidden>
    		
    		<table cellspacing="1" cellpadding="3" width="100%" bgcolor="#CCCCCC">
				<tr bgcolor="#FFFFFF">
					<td align="right" width="15%" class="label">
						问卷编号：
					</td>
					<td align="left" width="35%">
						<s:textfield id="pfCode" name="paperFix.pfCode" cssStyle="width:80%" maxlength="10"></s:textfield>
					</td>
					<td align="right" width="15%" class="label">
						姓名：
					</td>
					<td align="left" width="35%">
						<s:textfield id="pfName" name="paperFix.pfName" cssStyle="width:80%" maxlength="20"></s:textfield>
					</td>
				</tr>
				<tr bgcolor="#FFFFFF">
					<td align="right" class="label">
						性别：
					</td>
					<td align="left" colspan="3">
						<s:select list='#{"男":"男","女":"女"}' cssStyle="width:80px;" name="paperFix.pfSex" id="pfSex" headerKey="" headerValue="--请选择--"></s:select>
					</td>
				</tr>
			</table>
			
			<table width="100%" cellspacing="0">
    			<tr>
    				<td align="center" valign="bottom" height="30">
    					<input type="button" value="保存" class="btn" onclick="saveThis()" />
    				</td>
    			</tr>
    		</table>
    	</s:form>
    
    <script type="text/javascript">
    function saveThis()
    {
        var pfCode = $('#pfCode');
        var p = /^[0-9]*$/;
        if(!isNotNull(pfCode.val()))
        {
            showMsg('问卷编号不能为空。', function(){pfCode.focus();});
            return;
        }
        if(!p.exec(pfCode.val()))
        {
            showMsg('问卷编号只能为数字。', function(){pfCode.focus();});
            return;
        }
        ajaxAction('inner/qes/addPaperFix.action', 'post', 'frm', true, function(obj){
            if('hasCode' == obj.result)
            {
                showMsg('已存在该问卷编号。', function(){pfCode.focus();});
            }
            else
            {
                var returnId = obj.id;
                showMsg('保存成功。', function(){
                    getParentWin().location.href = realPath + '/inner/qes/toUpdatePaperFix.action?paperFix.id=' + returnId;
					window.close();
                });
            }
        });
    }
    </script>
  </body>
</html>
